/**
 * @file useManualRouteReport自定义钩子
 * @date 2025/10/29 18:37:30
 * @author lyqjob@yeah.net
 */

import {  useState, useEffect  } from 'react';
import { useLocation } from 'react-router-dom';

function useManualRouteReport() {
  const location = useLocation();
  const [previousLocation, setPreviousLocation] = useState(null);
  useEffect(() => {
    setPreviousLocation(location); // 更新previousLocation为当前location
  }, [location]); // 当location改变时，重新设置previousLocation

  return previousLocation;
}

export { useManualRouteReport };